package com.cyf.smartCity;

import com.cyf.smartCity.bean.*;
import com.cyf.smartCity.service.CenterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("智慧停管平台-集控管理")
@RequestMapping(value = "center/")
public class CenterHttpController {

    @Autowired
    private CenterService centerService;


    @PostMapping("device/getCurCarInfo")
    @ApiOperation(value = "获取当前通道车的信息")
    public WechatParkGetDeviceCurCarInfoRsp getDeviceCurCarInfo(@RequestBody WechatParkGetDeviceCurCarInfoReq req) {
        return centerService.getDeviceCurCarInfo(req);
    }

    @ApiOperation(value = "开闸", notes = "根据等待开闸的车牌号码或者设备id来开启道闸")
    @PostMapping(value = "openBarrier")
    public ApiOpenBarrierRsp openBarrier(@RequestBody ApiOpenBarrierReq req) {

        return centerService.openBarrier(req);
    }

    @ApiOperation(value = "关闸", notes = "根据设备Id来关闭道闸")
    @PostMapping(value = "closeBarrier")
    public ApiCloseBarrierRsp closeBarrier(@RequestBody ApiCloseBarrierReq req) {

        return centerService.closeBarrier(req);
    }

    @PostMapping("device/list")
    @ApiOperation(value = "获取通道列表")
    public WechatParkListDeviceRsp listDevice(@RequestBody WechatParkBasicReq req) {
        return centerService.listDevice(req);
    }


}
